<%@page import="com.ereport.entity.NewsUpdate"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="<%=application.getContextPath() %>/css/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=application.getContextPath() %>/js/jquery-1.6.min.js"></script>	
<script language="javascript" src="<%=application.getContextPath() %>/js/calendar_eu.js"></script>
<script type="text/javascript" src="<%=application.getContextPath() %>/js/jquery-ui-1.8.17.custom.min.js"></script>	
<link rel="stylesheet" href="<%=application.getContextPath() %>/css/jquery-ui-1.8.17.custom.css"/>
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.js"></script>	
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.min.js"></script>
</head>
<body>
<table width="927" style="height:880px" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="116" align="left" valign="top" background="<%=application.getContextPath() %>/images/top-bg.jpg" style="background-repeat:repeat-x; background-position:left top">
    <%@ include file="../common/exe-header.jsp" %>
    </td>
  </tr>
  <tr>
    <td  align="center" valign="top"><table width="927" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="20">&nbsp;</td>
        <td width="643" align="right"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="left" valign="top">&nbsp;<a href="<%=application.getContextPath() %>/user/open.do"><img src="<%=application.getContextPath() %>/images/home1.jpg" width="20" height="20" border="0" /></a></td>
              <td width="8%" align="center"><a href="<%=application.getContextPath() %>/user/logout.do" style="font-family: sans-serif;">&nbsp;&nbsp;Logout</a></td>
            </tr>
          </table>
        </td>
        <td width="20">&nbsp;</td>
      </tr>
      <tr>
        <td width="20">&nbsp;</td>
        <td align="center" valign="top" class="heading">News</td>
        <td width="20">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td align="right"></td>
        <td>&nbsp;</td>
      </tr>
      <%
      if(request.getParameter("msg")!=null){
      	out.println(request.getParameter("msg"));
      }
      %>
      
      <tr>
        <td>&nbsp;</td>
        <td align="center" valign="top">
        <form action="<%=application.getContextPath() %>/newsUpdate/create.do" method="post" name="newsForm" id="newsForm">
        <table width="870" border="0" cellspacing="0" cellpadding="0">
       <tr>
            <td align="left" valign="top">
           <table width="895" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td height="10" align="left" valign="top">
                	<%@ include file="../common/newsMenu.jsp" %>
                </td>
              </tr>
              <tr>
                <td>
                <%
                NewsUpdate nu=(NewsUpdate)request.getAttribute("news");
                %>
                <table width="100%" border="0" cellpadding="0" cellspacing="0" class="box-border1">
                  <tr>
                    <td width="366"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                          <td width="29">&nbsp;</td>
                          <td width="168">&nbsp;</td>
                          <td width="250">&nbsp;</td>
                          <td width="23">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="28">&nbsp;</td>
                          <td align="left" valign="top" class="content">Head Line</td>
                          <td align="left" valign="top">
                         <table width="100%" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                          	<td width="83%" align="left" valign="top">
                          	<input type="hidden" name="newsname" id="newsid" value="<%= nu.getId()%>"/> 
                          <input type="text" name="headLine" id="headLine" class="textfield required" style="width: 250px"  value="<%=nu.getHeadLine() %>"  tabindex="1"/></td>
                            <td width="17%" align="left" valign="top"></td>
                          </tr>
                          </table></td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top" class="content"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td align="left" valign="top" height="28" class="content">Literature </td>
                          <td align="left" valign="top">
                          <textarea name="literature" id="literature" class="textarea1" style="width: 276px;height: 115px;" tabindex="2"><%=nu.getLiterature().trim() %>
                          </textarea>
                          </td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top" class="content"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td align="left" valign="top" height="28" class="content">Action To Be Taken</td>
                          <td align="left" valign="top">
                          <textarea name="actToBeTaken" id="actToBeTaken" class="textarea1" style="width: 276px" tabindex="3"><%=nu.getActionToBeTaken().trim() %>
                          </textarea></td>
                          <td align="left" valign="top">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td align="left" valign="top"></td>
                        </tr>
	              </table></td>
                    <td width="330" align="left" valign="top"></td>
                  </tr>
                </table>
             </td>
              </tr>
              <tr>
                <td height="10" align="left" valign="top"></td>
              </tr>
              
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
              <td>
              
              </td>
              </tr>
              <tr>
                <td height="5"></td>
              </tr>
            </table>                       </td>
 		 </tr>
         
          
          <tr>
            <td align="left" valign="top">
            <a href="<%=application.getContextPath()%>/newsUpdate/open.do"><input type="button" class="button-black-right" value="New News"/></a>
            <input type="button" class="button-black-right"  value="Edit" onclick="javascript: retriveNews()"/>
            <input type="submit" class="button-black-right" value="Approve" />   
           
             </td>
          </tr>
          <tr>
            <td height="10">
            	<div id="ajaxLoader" style="display:none" align="center"><img src="<%=application.getContextPath()%>/images/load.gif"/></div> 
            </td>
          </tr>
          <tr>
            <td align="right" valign="top">&nbsp;</td>
          </tr>
          
          <tr>
            <td align="left" valign="top">&nbsp;</td>
          </tr>
        </table>
        </form>
        <div id="newsDialog" style="display: none;">
                  <div id="headlinesSearchBox">
           <form action="<%= application.getContextPath()%>/newsUpdate/getHeadLines.do" method="post">
           			   <br />
                    <select name="headLinesName" class="form" id="headLinesId">
               			 <option value="">Please Select</option>
                   </select>
                  	<br />
                  	<br />
                    <input class="button-right" type="submit" id="ok" value="OK"/> 
                    </form>
                    </div>
                    
        </div>
        </td>
        <td>&nbsp;</td>
      </tr>
      
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      
    </table></td>
  </tr>
  <tr>
    <td height="40" align="left" valign="top" bgcolor="#0B0B0B">&nbsp;</td>
  </tr>
</table>
</body>
</html>
<script  type="text/javascript">
function retriveNews(){
	
	$.ajax({
		url:" <%=application.getContextPath()%>/newsUpdate/searchHeadLines.do",
		mimetype: "text/plain",
		cache:false,
		success: function(res){
			var e2=document.getElementById('headLinesId');
			$('#headLinesId')
		    .find('option')
		    .remove()
		    .end()
		   	;
			var temp=res.split(",");
			var o=document.createElement('option');
			o.value="";
			o.text="Please Select";
			e2.options.add(o);
			if(temp != null){
				for(var i=0;i<temp.length-1;i++){
					var o=document.createElement('option');
					var t=temp[i].split("/");
					o.value=t[0];
					o.text=t[1];
					e2.options.add(o);
				}
			}
			
		}

	});

var $dialog = $('#newsDialog').dialog({
                autoOpen: false,
                modal: true,
                width: 250,
                height: 120,
              				
            });
 			 
            $dialog.dialog('open');
}
</script>